package com.hwl.demo3.service.impl;

import com.hwl.demo3.service.ISale;

/**
 * @author sentry
 * @since 2023-02-28
 */
public class CashSuper implements ISale {

    protected ISale iSale;

    public void decorate(ISale iSale) {
        this.iSale = iSale;
    }

    @Override
    public double acceptCash(double price, int num) {
        double result = 0d;
        if (this.iSale != null) {
            // 若装饰对象存在，则执行装饰的算法运算
            result = this.iSale.acceptCash(price, num);
        }
        return result;
    }
}
